/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.lang.reflect.Field;

/**
 * <p>Project: jse2303 - Reflect01</p>
 * <p>Powered by webrx On 2023-07-28 11:02:27</p>
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Reflect03 {
    public static void main(String[] args) throws Exception {
        Apple a = new Apple();
        System.out.println(a.getName());

        //反射
        Class<Apple> c = Apple.class;
        Field f = c.getDeclaredField("name");

        AppleName annotation = f.getAnnotation(AppleName.class);
        System.out.println(annotation.name());

        Ann ann = f.getAnnotation(Ann.class);
        System.out.println(ann.name());


    }
}
